/**
 * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.nightonke.boommenusample;

import com.nightonke.boommenu.BoomMenuButton;
import ohos.agp.components.Component;
import ohos.agp.components.Text;


/**
 * Created by Weiping Huang at 02:25 on 16/12/6
 * For Personal Open Source
 * Contact me at 2584541288@qq.com or nightonke@outlook.com
 */

class RecyclerViewAdapter {

//    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        holder.text.setText("No. " + position);

        holder.bmb1.clearBuilders();
        for (int i = 0; i < holder.bmb1.getPiecePlaceEnum().pieceNumber(); i++)
            holder.bmb1.addBuilder(BuilderManager.getSimpleCircleButtonBuilder());

        holder.bmb2.clearBuilders();
        for (int i = 0; i < holder.bmb2.getPiecePlaceEnum().pieceNumber(); i++)
            holder.bmb2.addBuilder(BuilderManager.getHamButtonBuilder());

        holder.bmb3.clearBuilders();
        for (int i = 0; i < holder.bmb3.getButtonPlaceEnum().buttonNumber(); i++)
            holder.bmb3.addBuilder(BuilderManager.getSimpleCircleButtonBuilder());
    }

//    @Override
    public int getItemCount() {
        return 1000;
    }

    class ViewHolder {
        private Text text;
        private BoomMenuButton bmb1;
        private BoomMenuButton bmb2;
        private BoomMenuButton bmb3;

        ViewHolder(Component view) {
//            super(view);
//            this.text = (Text) view.findComponentById(ResourceTable.Id_text);
//            this.bmb1 = (BoomMenuButton) view.findComponentById(ResourceTable.Id_bmb1);
//            this.bmb2 = (BoomMenuButton) view.findComponentById(ResourceTable.Id_bmb2);
//            this.bmb3 = (BoomMenuButton) view.findComponentById(ResourceTable.Id_bmb3);
        }
    }
}
